<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="admin/css/common.css" type="text/css" />
<link rel="stylesheet" href="admin/css/swfupload.css" type="text/css" />
<title>添加石材</title>
<script type="text/javascript" src="admin/js/jquery-1.7.1.js"></script>
<script type="text/javascript">
	function submitForm(){
		if(validate()==true){
			document.detailForm.submit();
		};		
	}
	function validate(){
		var str = $.trim($('#chineseName').val());
		if(!textValidate(str, $('#chineseName'), $('#cnameTip'), 50)){
			return false;
		}

		str = $.trim($('#englishName').val());
		if(!textValidate(str, $('#englishName'), $('#enameTip'), 50)){
			return false;
		}

		/*str = $.trim($('#sourceland').val());
		if(!textValidate(str, $('#sourceland'), $('#sourcelandTip'), 50)){
			return false;
		}

		str = $.trim($('#category').val());
		if(!textValidate(str, $('#category'), $('#categoryTip'), 50)){
			return false;
		}

		str = $.trim($('#stoneWA').val());
		if(!textValidate(str, $('#stoneWA'), $('#stoneWATip'), 50)){
			return false;
		}
		
		str = $.trim($('#stoneBD').val());
		if(!textValidate(str, $('#stoneBD'), $('#stoneBDTip'), 50)){
			return false;
		}
		
		str = $.trim($('#stoneSH').val());
		if(!textValidate(str, $('#stoneSH'), $('#stoneSHTip'), 50)){
			return false;
		}
		
		str = $.trim($('#stoneMR').val());
		if(!textValidate(str, $('#stoneMR'), $('#stoneMRTip'), 50)){
			return false;
		}
		
		str = $.trim($('#stoneCS').val());
		if(!textValidate(str, $('#stoneCS'), $('#stoneCSTip'), 50)){
			return false;
		}
		
		str = $.trim($('#venation').val());
		if(!textValidate(str, $('#venation'), $('#venationTip'), 50)){
			return false;
		}*/

		str = $.trim($('#color').val());
		if(!textValidate(str, $('#color'), $('#colorTip'), 50)){
			return false;
		}

		/*str = $.trim($('#minprice').val());
		if(!numValidate(str, $('#minprice'), $('#minpriceTip'))){
			return false;
		}

		str = $.trim($('#minprice').val());
		if(!numValidate(str, $('#minprice'), $('#minpriceTip'))){
			return false;
		}

		str = $.trim($('#level').val());
		if(!textValidate(str, $('#level'), $('#levelTip'), 10)){
			return false;
		}

		str = $.trim($('#purpose').val());
		if(!textValidate(str, $('#purpose'), $('#purposeTip'), 50)){
			return false;
		}
		
		str = $.trim($('#successfulCase').val());
		if(!textValidate(str, $('#successfulCase'), $('#successfulCase'), 50)){
			return false;
		}*/
		return true;
	}
	function textValidate(str, id, tipId, l){
		if(str.length == 0)
		{
			tipId.hide();
			tipId.html("*不能为空");
			id.focus();
			tipId.fadeIn();
			return false;
		}
		else if(str.length>l)
		{
			tipId.hide();
			tipId.html("*不能超过50个字");
			id.focus();
			tipId.fadeIn();
			return false;
		}
		else{
			tipId.hide();
			return true;
		}
	}

	function numValidate(str, id, tipId){
		if(str.length == 0)
		{
			tipId.hide();
			tipId.html("*不能为空");
			id.focus();
			tipId.fadeIn();
			return false;
		}
		var reg = /[^\d\.]/g; 
		if(str.match(reg)!=null){
			tipId.hide();
			tipId.html("*请输入正确的数字");
			id.focus();
			tipId.fadeIn();
			return false;
		}else{
			tipId.hide();
			return true;
		}
	}
	</script>
<style>
.tip {
	margin-left: 10px;
	font-size: 9pt;
	color: red;
}

input {
	height: 25px;
	line-height: 20px;
	background: #FFF;
	padding: 2px 5px 2px 5px;
	margin: 0;
	border: 1px solid #CCCCCC;
	cursor: pointer;
}

select {
	width: 120px;
	height: 24px;
	line-height: 24px;
}

.inputDiv {
	height: 30px;
	margin-top: 20px;
}

.box {
	width: 99%;
	margin-bottom: 50px;
}

.box .hd {
	height: 30px;
	line-height: 30px;
	margin: 0px 10px 0px 10px;
	padding-left: 30px;
	color: #333333;
	font-weight: bold;
	font-size: 14px;
	border-bottom: 1px solid #CCCCCC;
	background: #EAEAEA;
	margin-bottom: -1<div class="box">   
	<div class="hd">修改石材基本信息</div>   
	<div class="bd">px;
}

.box .bd {
	margin: 10px;
	padding: 10px;
	margin-top: 0px;
	border: 1px solid #CCCCCC
}
</style>
</head>

<body>
	<div id="man_zone">
		<div class="box">
			<div class="hd">修改石材基本信息</div>
			<div class="bd">
				<form action="admin/modifyStoneBase.action" name=detailForm
					method="post">
					<input type="hidden" value="${stone.id }" name="stone.id" />
					<table width="99%" border="1" align="center" cellpadding="3"
						cellspacing="1">
						<tr>
							<td width="18%" class="left_title_1"><span
								class="left-title">中文名：</span>
							</td>
							<td width="82%"><input type="text" name="stone.chineseName"
								id="chineseName" size="50" value="${stone.chineseName }" /><span
								class="tip" id="cnameTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_2">英文名：</td>
							<td><input type="text" name="stone.englishName"
								id="englishName" size="50" value="${stone.englishName }" /><span
								class="tip" id="enameTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_1">原产地：</td>
							<td><input type="text" name="stone.sourceland"
								id="sourceland" size="50" value="${stone.sourceland }" /><span
								class="tip" id="sourcelandTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_2">种类：</td>
							<td><select name="stone.material" id="category"
								value="${stone.material }">
									<option
										<c:if test="${stone.material =='花岗石'  }">selected='selected'</c:if>
										value="花岗石">花岗石</option>
									<option
										<c:if test="${stone.material =='石灰石'  }">selected='selected'</c:if>
										value="石灰石">石灰石</option>
									<option
										<c:if test="${stone.material =='大理石'  }">selected='selected'</c:if>
										value="大理石">大理石</option>
									<option
										<c:if test="${stone.material =='石英岩'  }">selected='selected'</c:if>
										value="石英岩">石英岩</option>
									<option
										<c:if test="${stone.material =='板岩'  }">selected='selected'</c:if>
										value="板岩">板岩</option>
									<option
										<c:if test="${stone.material =='砂岩'  }">selected='selected'</c:if>
										value="砂岩">砂岩</option>
									<option
										<c:if test="${stone.material =='洞石'  }">selected='selected'</c:if>
										value="洞石">洞石</option>
									<option
										<c:if test="${stone.material =='玉石'  }">selected='selected'</c:if>
										value="玉石">玉石</option>
									<option
										<c:if test="${stone.material =='其它'  }">selected='selected'</c:if>
										value="其它">其它</option>
							</select> <span class="tip" id="categoryTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_1">抗压强度（C.S）：</td>
							<td><input type="text" name="stone.stoneCS" id="stoneCS" size="50" value="${stone.stoneCS }" /><span
								class="tip" id="stoneCSTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_2">抗折强度（M.R）：</td>
							<td><input type="text" name="stone.stoneMR" id="stoneMR" size="50" value="${stone.stoneMR} "/><span
								class="tip" id="stoneMRTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_1">肖氏硬度（S.H）：</td>
							<td><input type="text" name="stone.stoneSH" id="stoneSH" size="50" value="${stone.stoneSH }"/><span
								class="tip" id="stoneSHTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_2">岩石密度（B.D）：</td>
							<td><input type="text" name="stone.stoneBD" id="stoneBD" size="50" value="${stone.stoneBD}"/><span
								class="tip" id="stoneBDTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_1">吸水率（W.A）：</td>
							<td><input type="text" name="stone.stoneWA" id="stoneWA" size="50" value="${stone.stoneWA }"/><span
								class="tip" id="stoneWATip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_2">纹理：</td>
							<td><select name="stone.venation" id="venation">
									<option
										<c:if test="${stone.venation =='直纹'  }">selected='selected'</c:if>
										value="直纹">直纹</option>
									<option
										<c:if test="${stone.venation =='网纹'  }">selected='selected'</c:if>
										value="网纹">网纹</option>
									<option
										<c:if test="${stone.venation =='乱纹'  }">selected='selected'</c:if>
										value="乱纹">乱纹</option>
									<option
										<c:if test="${stone.venation =='其它纹路'  }">selected='selected'</c:if>
										value="其它纹路">其它纹路</option>
							</select> <span class="tip" id="venationTip"></span>
							</td>
						</tr>
						<tr>
							<td class="left_title_1">颜色：</td>
							<td><select name="stone.color" id="color">
									<option
										<c:if test="${stone.color =='白色'  }">selected='selected'</c:if>
										value="白色">白色</option>
									<option
										<c:if test="${stone.color =='黑色'  }">selected='selected'</c:if>
										value="黑色">黑色</option>
									<option
										<c:if test="${stone.color =='红色'  }">selected='selected'</c:if>
										value="红色">红色</option>
									<option
										<c:if test="${stone.color =='灰色'  }">selected='selected'</c:if>
										value="灰色">灰色</option>
									<option
										<c:if test="${stone.color =='黄色'  }">selected='selected'</c:if>
										value="黄色">黄色</option>
									<option
										<c:if test="${stone.color =='蓝色'  }">selected='selected'</c:if>
										value="蓝色">蓝色</option>
									<option
										<c:if test="${stone.color =='绿色'  }">selected='selected'</c:if>
										value="绿色">绿色</option>
									<option
										<c:if test="${stone.color =='紫色'  }">selected='selected'</c:if>
										value="紫色">紫色</option>
									<option
										<c:if test="${stone.color =='棕色'  }">selected='selected'</c:if>
										value="棕色">棕色</option>
									<option
										<c:if test="${stone.color =='青色'  }">selected='selected'</c:if>
										value="青色">青色</option>
									<option
										<c:if test="${stone.color =='彩色'  }">selected='selected'</c:if>
										value="彩色">彩色</option>
							</select> <span class="tip" id="colorTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_2">价格上限：</td>
							<td><input type="text" name="stone.minprice" id="minprice"
								size="50" value="${stone.minprice }" /><span class="tip"
								id="minpriceTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_1">价格下限：</td>
							<td><input type="text" name="stone.maxprice" id="maxprice"
								size="50" value="${stone.maxprice }" /><span class="tip"
								id="maxpriceTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_2">档次：</td>
							<td><select name="stone.level" id="level">
									<option
										<c:if test="${stone.level =='高档'  }">selected='selected'</c:if>
										value="高档">高档</option>
									<option
										<c:if test="${stone.level =='中档'  }">selected='selected'</c:if>
										value="中档">中档</option>
									<option
										<c:if test="${stone.level =='低档'  }">selected='selected'</c:if>
										value="低档">低档</option>
							</select> <span class="tip" id="levelTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_1">适用于：</td>
							<td><input type="text" name="stone.purpose" id="purpose"
								size="50" value="${stone.purpose }" /><span class="tip"
								id="purposeTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_2">成功案例：</td>
							<td><input type="text" name="stone.successfulCase"
								id="successfulCase" size="50" value="${stone.successfulCase }" /><span
								class="tip" id="successfulCaseTip"></span>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td class="left_title_1"></td>
							<td></td>
						</tr>
					</table>
					<div class="inputDiv" style="text-align:center">
						<input type="button" onclick="submitForm()" value="保存并继续" />&nbsp;&nbsp;&nbsp;<a
							href="admin/modifyStoneBase.action?flag=0&stoneId=${stone.id }">跳至下一步</a><span
							class="tip" id="submitTip"></span>
					</div>
				</form>
			</div>
		</div>

	</div>
</body>
</html>
